/*
 * @Author: Quinn
 * @Date: 2023-05-19 11:40:35
 * @LastEditors: 叽歪小Q
 * @Description:
 */
const formatUrl = (url, data, config) => {
    return `${url}/${data.id}`
}

const getList = [
    '/finance/getFinanceDataReimburseDetailById', //报销详情
    '/user/getUserNameByUserName', //模糊搜索报销接收人
    '/finance/getFinanceLevelTypeByFid', //二级联动
    '/finance/getReimburseTypeByOid', //承担主体联动
    '/finance/getReimburseType', //报销类型
    '/finance/getOptionerType', //责任主体列表
    '/finance/oneType', //一级分类-报销明细(人)
    '/finance/twoType', //二级分类-报销明细(人)
    '/order/getPaymentMethod', //新增订单-付款方式
    '/broken/deleteBroken', //报损单-删除
    '/broken/rejectBroken', //修改报损单状态-驳回
    '/broken/passBroken', //修改报损单状态-通过
    '/broken/getBrokenList', //获取报损列表
    '/broken/getBrokenDetailList', //获取单品
    '/order/getOfferDirectoryDown',
    '/storeLedger/getFinanceOneLevelTypeDto', //财务列表获取费用类型
    '/storeLedger/selectFinanceDetailsByFinanceId', //财务列表获取费用类型明细
    '/inventory/getInventoryGoodsList', //根据仓库查看产品库存
    'role/roleList',
    '/material/getMaterialInfoLikeName',
    '/order/getOrderInfoLikeName',
    '/new/areaLedger/types',
    '/areaLedger/fyTypeList',
    '/areaLedger/areaList',
    '/factory/getFactoryList', //工厂列表
    '/new/areaLedger/list',
    '/new/storeLedger/stores',
    '/new/storeLedger/types',
    '/new/storeLedger/list',
    '/new/order/costs',
    '/new/finance/list',
    '/new/finance/reject/list',
    '/new/cad/parse/texts',
    '/new/cad/parse/result',
    '/new/afterSale/materials',
    '/material/inout/materials',
    '/new/order/out/materials',
    '/new/order/material/list',
    '/new/order/addition/list',
    '/new/order/storage/list',
    '/new/payment/list',
    '/afterSale/list',
    '/new/install/list',
    '/material/material/addition/list',
    '/new/province/enum',
    '/new/afterSaleTypes/enum',
    '/inStorage/inStorageList',
    '/areaLedger/areaLedgerList',
    '/storeLedger/storeLedgerList',
    '/areaLedger/areaListNew', //不受权限控制的仓库列表
    '/inventory/getLocationName', //库位列表
    '/user/userList',
    '/home/getHomeSellInfo',
    '/inventory/inventoryList',
    '/order/additionList',
    '/order/orderAdditionDetail',
    '/order/paymentDetials',
    '/order/installers',
    '/order/goodsDirectorys',
    '/order/orderAdditionDetail',
    '/user/userInfo',
    '/home/getHomeAfterSaleInfo',
    '/home/getHomePageInfo',
    '/check/checkList', //盘点列表
    '/purchase/getFactoryOutList', //查询工厂库存列表
    '/purchase/getAreaPutNum', //查询入库数量
    '/purchase/inspectPurchaseCompleteStatus', //查询采购订单是否已完成
    '/purchase/getFactoryInRecord', //查询修改库存记录
    '/storeLedger/getFinanceLevelTypeDto',
    '/storeLedger/getAccountName',
    '/order/getOrderExpressCharge', //财务获取订单运费
    '/storeLedger/updateSupervisorStatus', //仓库主管通过报销
    '/contract/getContractList', //查看合同列表
    '/order/selectInstallationUser', //查看施工人员列表
    '/directory/directoryList',
    '/order/submitOrder',
    '/order/getPerOrderList', //查看施工人员列表
    '/purchase/getSupplierVo',
    '/purchase/getSupplierMaterialPrice',
    '/purchase/getMaterialInfoByProductName',
    '/order/getDirectoryVo',
    '/order/getQuotationList',
    '/order/getSystemTypeVo',
    '/refund/getCustomerRefund', // 查看退款记录详情
    '/new/afterSaleNew/materials',
    '/new/afterSaleNew/inOutMaterials',
    '/tagByPurchaseDeliver/getTagByPurchaseDeliverList',
    '/purchase/getPurchaseOrderByDelivery',
    '/tagByPurchaseDeliver/getPaperDeliveryExcel',
    '/new/cad/getRecordUsage',
    '/api/getDeviceList',
    '/camera/getAreaCameraList',
    '/camera/getAreaAllCamera',
    '/storeLedger/getStoreReimburseDetail',
    '/firmCamera/getLiveAddress',
    '/vehicle/getVehicleModel',
    '/getVehicleModel',
    '/commission/getCommissionTypes',
    '/commission/getCommissionConfig',
    '/commissionDetails/commissionDetailsView',
    '/commission/getCommissionTypes2',
    '/oldByNewConfig/getOldByNewConfig',
    '/account/oldEmployeeList',
    '/commissionDetails/selectPickupGroup',
    '/role/getAuthorityList',
    '/role/getAuthorityListByRoleId',
    '/area/list',
    '/area/getWarehouseId',
    '/role/getRoleList',
    '/firmCamera/getLiveAddress', //查询序列号是否被绑定
    '/orderNew/page',
    '/orderNew/detail',
    '/wx/userUploadImg',
    '/account/getUserUploadImgUrl',
    '/order/getOrderInfoNameByFinance',
    '/commissionDetails/getCommissionMonthSummaryExcel',
    '/order/getStorageDetailedDown',
    '/material/getGoodsTitleList',
    '/material/getMaterialBrandList',
    '/afterSale/getAfterSaleAddNew',
    '/directory/getMaterialDirectoryVo',
    '/payment/paymentView',
]
const postList = [
    '/payment/editPayment',
    '/payment/deletePayment',
    '/payment/addOtherPayment',
    '/directory/updateMaterialDirectory',
    '/directory/updateDirectoryInfo',
    '/directory/addDirectoryInfo',
    '/directory/directoryListNew',
    '/material/getMaterialList',
    '/material/updateMaterialInfo',
    '/material/addMaterial',
    '/order/addZYMCashPayment',
    '/order/updateSendCadGoods',
    '/order/addMaterialPayment',
    '/finance/getFinanceDataReimburseCaiWuList',
    '/order/autoRecognizeMaterialInfo',
    '/commissionDetails/deleteCommissionDetails',
    '/commissionDetails/selectCommissionDetailsPage',
    '/common/excelImg', //上传带img的excel
    '/finance/updateFinanceDataInfo',
    '/finance/getFinanceDataReimburseZhaoFengJiaoList',
    '/orderNew/add',
    '/orderNew/delivery',
    '/afterSale/updateSaleMoney',
    '/commissionDetails/distribution',
    '/finance/addReimburseType', //添加报销类型
    '/finance/updateReimburseType', //修改报销类型
    '/finance/deleteReimburseType', //删除报销了类型
    '/finance/deleteFinanceLevelType', //删除二级分类
    '/finance/updateFinanceLevelType', //修改二级分类
    '/finance/addFinanceLevelType', //添加二级分类
    '/role/assignAuthority',
    '/area/permission',
    '/role/updateRoleStatus',
    '/finance/deleteFinanceDataReimburse', //删除报销明细(人)
    '/order/getMaterialOrderVO',
    '/add/materialOrder',
    '/order/addPayment',
    '/order/getPaymentList',
    '/order/updatePaymentPayState',
    '/finance/addFinanceType', //添加一级分类
    '/finance/addFinanceLevelType', //添加二级分类
    '/finance/updateFinanceLevelType', //修改二级分类
    '/finance/updateFinanceType', //修改一级分类
    '/finance/updateFinanceDataReimburseStatus', //审核报销明细(审核，打款，取消)
    '/finance/getFinanceDataReimburseByStoreNameSummaryList', //报销明细(店)
    '/finance/addFinanceDataReimburse', //添加报销明细(人)
    '/finance/getFinanceDataReimburseList', //报销明细(人)
    '/oldByNewConfig/updateOldByNewConfig',
    '/commissionDetails/cancelCommission',
    '/commissionDetails/auditCommissionDetails',
    '/order/insertStoreInfo', //录入门店信息-增加单列表
    '/commissionDetails/addCommissionDetails',
    '/commission/updateCommissionConfig',
    '/vehicle/deleteVehicleModel',
    '/vehicle/updateVehicleModel',
    '/vehicle/addVehicleModel',
    '/order/updateAzGoodsCount',
    '/order/updatePayStatus', //订单-修改收款到账状态
    '/order/add', //订单-录入订单(材料录入创建订单)
    '/radar/connect',
    '/api/addSku',
    '/api/updateSKUInfo',
    '/api/getTagInventoryRecordList',
    '/api/updateTagInfoNumAndLocation',
    '/test/decryption',
    '/purchase/purchaseOrderDelivery',
    '/api/getTagInfoListBySku',
    '/api/getTagInfoList',
    '/factory/updateFactoryWareHousePosition',
    '/material/inventory/factoryInOutList/excleList', // 获取工厂excel文件内容列表
    '/new/afterSale/afterSaleNewOut', // 获取工厂excel文件内容列表
    '/material/inventory/factoryInOut/excle', // 确定上传
    '/new/afterSale/afterSaleNewOut',
    '/refund/addCustomerRefund',
    '/afterSale/import/excelOut',
    '/finance/getOldStoreDetailList',
    '/finance/deleteOldStoreDetailFee',
    '/finance/updateOldStoreDetailFee',
    '/finance/addOldStoreDetailFee',
    '/purchase/calculateFinanceInfo',
    '/new/cad/parse2',
    '/finance/updateZymCashRegister',
    '/finance/deleteZymCashRegister',
    '/finance/getZymCashRegisterList',
    '/finance/addZymCashRegister',
    '/finance/addDetailFee',
    '/finance/deleteDetailFee',
    '/finance/updateDetailFee',
    '/finance/getDetailList',
    '/purchase/productAndSupplier',
    '/purchase/import/excelFeedback',
    '/material/inventory/purchaseImport/execl',
    '/order/getMaterialCommissionSummary',
    '/order/cancelCarMaterialCommission',
    '/order/getCarMaterialCommissionNameList',
    '/order/addCarMaterialCommissionName',
    '/purchase/updateCompleteInOutStatus',
    '/purchase/purchaseMaterialAddInventory',
    '/order/cancelCommission', //取消提成
    '/order/cancelMaterialCommission', //取消材料提成
    '/order/addMaterialCommissionName', //添加材料提成
    '/order/getMaterialCommissionNameList', //材料提成列表
    '/order/getCommissionSummary', //查询总提成
    '/order/getCommissionListByType', //提成列表
    '/broken/updateBroken', //修改报损凭证
    '/order/updateIsDebt', //修改报损凭证
    '/storeLedger/updateStoreLedgerFinanceStatus2', //修改报损凭证
    '/broken/updateBroken', //报损单编辑
    '/broken/updateBroken', //报损单修改
    '/broken/addBroken', //新增报损单
    '/dashboards/getAfterSaleInfo', //
    '/dashboards/getPurchaseData', //dataContact
    '/storeLedger/updateStoreLedgerDetails', //修改报销
    '/dashboards/getBrandHistogramData', //dataContact
    '/dashboards/getAreaLineChart', //dataContact
    '/user/userInfoUpdate',
    '/user/logout',
    '/storeLedger/deleteOrUpdateStoreLedger',
    '/areaLedger/updateAreaLedgerStatus',
    '/storeLedger/addStoreLedgerDetails',
    '/inventory/getInventoryList',
    '/user/deleteUser',
    '/user/addUser',
    '/storeLedger/getStoreLedger',
    '/afterSale/updateAfterSaleInfo',
    '/areaLedger/addAreaLedger',
    '/order/addPayment',
    '/order/insertAddition',
    '/new/areaLedger/create',
    '/new/storeLedger/create',
    '/new/storeLedger/update',
    '/new/finance/reject/update',
    '/storeLedger/updateStoreLedgerFinanceStatus', //更新报销状态
    '/storeLedger/updateSupervisorStatus', //更新报销状态
    '/new/finance/delete',
    '/new/afterSale/delete',
    '/factory/getFactoryMaterialList', //工厂库存列表
    '/factory/updateFactoryInventoryNum', //修改工厂库存
    '/factory/addFactoryMaterial', //添加工厂产品
    '/purchase/getPurchaseList', //采购单列表
    '/purchase/addPurchase', //新增采购单
    '/purchase/deductionFactoryInventory', //工厂出库扣减库存
    '/purchase/purchaseMaterialAddInventory', //操作入库
    '/order/updateOrderCadUserId', //cad操作认领
    '/order/orderList',
    // "/new/order/delete",
    '/order/orderDelete',
    '/single/addSingle', //单品出库新增
    '/single/getSingleList', //单品出库新增
    '/single/updateSingle', //单品出库编辑
    '/single/singleOutInventory', //单品出库扣库存
    '/allot/addAllotMaterial', //调货新增
    '/allot/getAllotMaterial', //调货列表
    '/allot/updateOutProofByAllotNo', //上传调出凭证
    '/allot/updateAllotMaterial', //编辑调货单
    '/allot/allotOutAndInInventory', //调货单确认完成
    '/check/checkAdd', //新增盘点单
    '/check/updateStatus', //改变盘点状态
    '/check/checkDelete', //删除
    '/inventory/updateLocationName', //编辑库位
    '/purchase/purchaseMaterialAddInventory', //采购单入库
    '/purchase/deletePurchase', //删除采购单
    '/purchase/updatePurchaseStatus', //审核采购单
    '/new/finance/update',
    '/new/afterSale/update',
    '/order/confirmOrder', //订单列表 确认订单锁库存
    '/order/outNew', //订单出库
    '/inventory/updateInventoryWarningNum', //订单出库
    '/purchase/updateDamageNum', //采购单仓库报损
    '/purchase/updateDamageStatus', //采购单工厂确认报损
    '/purchase/updatePurchaseData', //修改采购单
    '/order/CancelRollbackInventory', //回滚订单列表库存
    '/order/getSmsSendRecordList', //短信预警列表
    '/factory/updateFactoryWarningNum', //工厂库存预警
    '/new/install/create',
    '/new/afterSale/create',
    '/new/payment/create',
    '/new/order/create',
    '/new/order/update',
    '/new/order/out',
    '/new/cad/parse',
    '/order/orderInfoUpdate',
    '/order/addInstaller',
    '/afterSale/afterSaleAdd',
    '/storeLedger/updateStoreLedger',
    '/storeLedger/updateStoreLedgerStatus',
    '/areaLedger/deleteOrUpdateAreaLedger',
    '/order/closeOrderReimbursement', //关闭报销订单
    '/order/cancelContract', //关闭报销订单
    '/single/getSingleListDetail', //单品出库
    '/order/confirmOrderSenior',
    '/afterSale/getAfterSaleNewList',
    '/afterSale/addAfterSaleNew',
    '/afterSale/deleteAfterSaleNew',
    '/afterSale/updateAfterSaleNewInfo',
    '/purchase/updateFinanceInfo',
    '/finance/getOtherList', //查询财务其他单列表
    '/finance/updateOtherFee', //更新其他单
    '/finance/addOtherFee', //添加其他费用
    '/finance/deleteOtherFee', //删除其他单
    '/finance/getZymAddOrderList', //查询zym增加单列表
    '/finance/addZymAddOrder', //新增zym增加单
    '/finance/deleteZymAddOrder', //删除zym增加单
    '/finance/updateZymAddOrder', //更新zym增加单
    '/order/GetDXFPoints',
    '/new/cad/updateCadAnalysis',
    '/directory/deleteDirectory'
]

const initApi = (arr, method = 'get') => {
    const res = {}
    arr.forEach((url) => {
        const key = url
            .split('/')
            .filter((e) => e)
            .map((str, index) => {
                if (index > 0) return str.slice(0, 1).toUpperCase() + str.slice(1)
                return str
            })
            .join('')
        res[key] = {
            url,
            method,
        }
        if (method == 'post') res[key]['contentType'] = 'application/json'
    })
    return res
}

export default {
    ...initApi(getList),
    ...initApi(postList, 'post'),
    login: {
        url: '/user/login',
    },
    getAccountInfo: {
        url: '/account',
        method: 'get',
        formatUrl,
    },
    deleteRole: {
        url: '/role',
        method: 'delete',
        formatUrl,
    },
    addRole: {
        url: '/role',
        method: 'post',
    },
    getRole: {
        url: '/role/roleList',
        method: 'get',
    },
    patchRole: {
        url: '/role',
        method: 'patch',
        formatUrl,
    },
    getLeaders: {
        url: '/account/managers/list',
        method: 'get',
    },
    getAzItem: {
        url: '/order/selectInstallationUser',
        method: 'get',
    },
    getAccount: {
        url: '/user/userList',
        method: 'get',
    },
    updatePsd: {
        url: '/account/update_password',
        method: 'post',
    },
    addAccount: {
        url: '/account',
        method: 'post',
        contentType: 'application/json',
    },
    setAccountRole: {
        url: '/account_role',
        method: 'post',
        contentType: 'application/json',
    },
    patchAccount: {
        url: '/account',
        method: 'patch',
        formatUrl,
    },
    deleteAccount: {
        url: '/account',
        method: 'delete',
        formatUrl,
    },
    getInventoryWarn: {
        url: '/material/inventory/alarm',
        method: 'get',
    },
    getInventory: {
        url: '/inventory/getInventoryList',
        method: 'post',
    },
    patchInventory: {
        url: '/material/inventory/update',
        method: 'post',
        contentType: 'application/json',
    },
    getInout: {
        url: '/inout/inOutRecordList',
        method: 'post',
    },
    inoutUpdate: {
        url: '/order/out',
        contentType: 'application/json',
        method: 'post',
    },
    addInout: {
        url: '/material/inout',
        method: 'post',
        contentType: 'application/json',
    },
    addMaterial: {
        url: '/material',
        contentType: 'application/json',
    },
    editMaterial: {
        url: '/material',
        contentType: 'application/json',
    },
    patchMaterial: {
        url: '/material/updateMaterialStatus',
        method: 'post',
        contentType: 'application/json',
    },
    updateMaterial: {
        url: '/material/materialUpdate',
        method: 'post',
        contentType: 'application/json',
    },
    deleteMaterial: {
        url: '/material/delMaterial',
        method: 'post',
        contentType: 'application/json',
    },
    qrcodeMaterial: {
        url: '/material/qrcode',
        method: 'get',
    },
    getMaterial: {
        url: '/material/queryMaterialPage',
        method: 'get',
    },
    getInstall: {
        url: '/order/install/list',
        method: 'get',
    },
    getOrderQuotation: {
        url: '/order/quotation',
        method: 'get',
    },
    getQuoteMaterials: {
        url: '/order/quotation/materials',
        method: 'get',
    },
    createQuotation: {
        url: '/order/quotation',
        method: 'post',
        contentType: 'application/json',
        formatUrl,
    },
    getExtraOrder: {
        url: '/order/extraOrder',
        method: 'get',
    },
    patchExtraOrder: {
        url: '/order/extraOrder',
        method: 'post',
        contentType: 'application/json',
        formatUrl,
    },
    orderList: {
        url: '/order/orderList',
        method: 'post',
    },
    orderDetail: {
        url: '/order/detail',
        method: 'get',
        formatUrl,
    },
    upload: {
        url: '/common/upload',
        method: 'post',
        contentType: 'multipart/form-data',
    },
    patchOrder: {
        url: '/order',
        method: 'post',
        contentType: 'application/json',
        formatUrl,
    },
    orderFlow: {
        url: '/order/orderFlow',
        method: 'get',
    },
    orderLine: {
        url: '/order/order/line',
        method: 'get',
    },
    addDirectory: {
        url: '/directory/addDirectory',
    },
    impInventoryExcel: {
        url: '/material/inventory/import/execl',
    },
    getDirectory: {
        url: '/directory/directoryList',
        method: 'get',
    },
    patchDirectory: {
        url: '/directory/updateDirectory',
        method: 'post',
        contentType: 'application/json',
        // formatUrl,
    },
}
